package com.hooya.fa.eu.biz.dao.repository.impl;

import com.hooya.fa.eu.biz.dao.entity.TempXsjlAbnormal;
import com.hooya.fa.eu.biz.dao.entity.TempXsjlDelete;
import com.hooya.fa.eu.biz.dao.mapper.stk.TempXsjlAbnormalMapper;
import com.hooya.fa.eu.biz.dao.mapper.stk.TempXsjlDeleteMapper;
import com.hooya.fa.eu.biz.dao.repository.TempXsjlRelationRepository;
import com.hooya.fa.eu.biz.dao.wrapper.TempXsjlAbnormalWrapper;
import com.hooya.fa.eu.biz.dao.wrapper.TempXsjlDeleteWrapper;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Repository;
import org.springframework.util.CollectionUtils;

import java.util.ArrayList;
import java.util.List;

/**
 * @Description 销售相关操作库
 * @Author : Zongz
 * @Copyright Copyright (c) 豪雅集团
 * @Create 2024/10/21
 * @Version 1.1.0
 */
@Slf4j
@Repository
@RequiredArgsConstructor
public class TempXsjlRelationRepositoryImpl implements TempXsjlRelationRepository {

    private final TempXsjlDeleteMapper tempXsjlDeleteMapper;

    private final TempXsjlAbnormalMapper tempXsjlAbnormalMapper;


    @Override
    public List<TempXsjlDelete> getDeleteListByCondition(String place, String belongs, String date, List<String> skuList) {
        List<TempXsjlDelete> res = tempXsjlDeleteMapper.selectList(
                TempXsjlDeleteWrapper.newQuery().eqPlace(place).eqBelongs(belongs).geOrderDate(date).inSku(skuList));
        return CollectionUtils.isEmpty(res) ? new ArrayList<>() : res;
    }

    @Override
    public List<TempXsjlAbnormal> getAbnormalListByCondition(String place, String date, List<String> skuList) {
        List<TempXsjlAbnormal> res = tempXsjlAbnormalMapper.selectList(
                TempXsjlAbnormalWrapper.newQuery().eqPlace(place).geOrderDate(date).inSku(skuList));
        return CollectionUtils.isEmpty(res) ? new ArrayList<>() : res;
    }
}